package semaforos is

  type Semaphore is private;
  type Binary_Semaphore is private;

  function Init(N: Integer) return Semaphore;
  procedure Wait  (S: Semaphore);
  procedure Signal(S: Semaphore);

  function Init(N: Integer) return Binary_Semaphore;
  procedure Wait  (S: Binary_Semaphore);
  procedure Signal(S: Binary_Semaphore);

  Bad_Semaphore_Initialization: exception;

private

  task type Semaphore_Task is
    entry Init(N: Integer; B: Boolean);
    entry Wait;
    entry Signal;
  end Semaphore_Task;

  type Semaphore is access Semaphore_Task;
  type Binary_Semaphore is access Semaphore_Task;

end semaforos;

